package com.gmlive.common.sample.svga;

import android.net.Uri;

import com.gmlive.svgaplayer.IkCosler;
import com.gmlive.svgaplayer.request.SVGARequest;
import com.opensource.svgaplayer.SVGAImageView;

/**
 * @Author svenj
 * @Date 2021/1/11
 * @Email svenjzm@gmail.com
 */
public class SVGAUtils {

    public static void loadSvgaFromUrl(SVGAImageView svgaImageView, String url) {
        SVGARequest request = new SVGARequest.Builder(svgaImageView.getContext())
                .data(url)
                .build();
        IkCosler.enqueue(request);
    }

    public static void loadSvgaFromAssets(SVGAImageView svgaImageView, String assetName) {
        SVGARequest request = new SVGARequest.Builder(svgaImageView.getContext())
                .data(Uri.parse("file:///android_asset/" + assetName))
                .target(svgaImageView)
                .build();
        IkCosler.enqueue(request);
    }
}
